{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "http://www.stat.yale.edu/Courses/1997-98/101/linreg.htm"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Using TensorFlow backend.\n"
     ]
    }
   ],
   "source": [
    "import pandas as pd\n",
    "\n",
    "import numpy as np\n",
    "import keras\n",
    "\n",
    "from matplotlib import pyplot as plt\n",
    "\n",
    "from keras.layers import Input, Dense\n",
    "from keras.models import Model\n",
    "\n",
    "from sklearn.preprocessing import StandardScaler, MinMaxScaler, Normalizer\n",
    "\n",
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "df = pd.read_csv(\"data.csv\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Country</th>\n",
       "      <th>Life Expectancy</th>\n",
       "      <th>People per Television</th>\n",
       "      <th>People per Physician</th>\n",
       "      <th>Female Life Expectancy</th>\n",
       "      <th>Male Life Expectancy</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Argentina</td>\n",
       "      <td>70.5</td>\n",
       "      <td>4</td>\n",
       "      <td>370</td>\n",
       "      <td>74</td>\n",
       "      <td>67</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Bangladesh</td>\n",
       "      <td>53.5</td>\n",
       "      <td>315</td>\n",
       "      <td>6166</td>\n",
       "      <td>53</td>\n",
       "      <td>54</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Brazil</td>\n",
       "      <td>65.0</td>\n",
       "      <td>4</td>\n",
       "      <td>684</td>\n",
       "      <td>68</td>\n",
       "      <td>62</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Canada</td>\n",
       "      <td>76.5</td>\n",
       "      <td>1.7</td>\n",
       "      <td>449</td>\n",
       "      <td>80</td>\n",
       "      <td>73</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>China</td>\n",
       "      <td>70.0</td>\n",
       "      <td>8</td>\n",
       "      <td>643</td>\n",
       "      <td>72</td>\n",
       "      <td>68</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>Colombia</td>\n",
       "      <td>71.0</td>\n",
       "      <td>5.6</td>\n",
       "      <td>1551</td>\n",
       "      <td>74</td>\n",
       "      <td>68</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>Egypt</td>\n",
       "      <td>60.5</td>\n",
       "      <td>15</td>\n",
       "      <td>616</td>\n",
       "      <td>61</td>\n",
       "      <td>60</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>Ethiopia</td>\n",
       "      <td>51.5</td>\n",
       "      <td>503</td>\n",
       "      <td>36660</td>\n",
       "      <td>53</td>\n",
       "      <td>50</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>France</td>\n",
       "      <td>78.0</td>\n",
       "      <td>2.6</td>\n",
       "      <td>403</td>\n",
       "      <td>82</td>\n",
       "      <td>74</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>Germany</td>\n",
       "      <td>76.0</td>\n",
       "      <td>2.6</td>\n",
       "      <td>346</td>\n",
       "      <td>79</td>\n",
       "      <td>73</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>India</td>\n",
       "      <td>57.5</td>\n",
       "      <td>44</td>\n",
       "      <td>2471</td>\n",
       "      <td>58</td>\n",
       "      <td>57</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>Indonesia</td>\n",
       "      <td>61.0</td>\n",
       "      <td>24</td>\n",
       "      <td>7427</td>\n",
       "      <td>63</td>\n",
       "      <td>59</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>Iran</td>\n",
       "      <td>64.5</td>\n",
       "      <td>23</td>\n",
       "      <td>2992</td>\n",
       "      <td>65</td>\n",
       "      <td>64</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>Italy</td>\n",
       "      <td>78.5</td>\n",
       "      <td>3.8</td>\n",
       "      <td>233</td>\n",
       "      <td>82</td>\n",
       "      <td>75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>Japan</td>\n",
       "      <td>79.0</td>\n",
       "      <td>1.8</td>\n",
       "      <td>609</td>\n",
       "      <td>82</td>\n",
       "      <td>76</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>Kenya</td>\n",
       "      <td>61.0</td>\n",
       "      <td>96</td>\n",
       "      <td>7615</td>\n",
       "      <td>63</td>\n",
       "      <td>59</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>Korea, North</td>\n",
       "      <td>70.0</td>\n",
       "      <td>90</td>\n",
       "      <td>370</td>\n",
       "      <td>73</td>\n",
       "      <td>67</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>Korea, South</td>\n",
       "      <td>70.0</td>\n",
       "      <td>4.9</td>\n",
       "      <td>1066</td>\n",
       "      <td>73</td>\n",
       "      <td>67</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>Mexico</td>\n",
       "      <td>72.0</td>\n",
       "      <td>6.6</td>\n",
       "      <td>600</td>\n",
       "      <td>76</td>\n",
       "      <td>68</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>Morocco</td>\n",
       "      <td>64.5</td>\n",
       "      <td>21</td>\n",
       "      <td>4873</td>\n",
       "      <td>66</td>\n",
       "      <td>63</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>Myanmar (Burma)</td>\n",
       "      <td>54.5</td>\n",
       "      <td>592</td>\n",
       "      <td>3485</td>\n",
       "      <td>56</td>\n",
       "      <td>53</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>Pakistan</td>\n",
       "      <td>56.5</td>\n",
       "      <td>73</td>\n",
       "      <td>2364</td>\n",
       "      <td>57</td>\n",
       "      <td>56</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>Peru</td>\n",
       "      <td>64.5</td>\n",
       "      <td>14</td>\n",
       "      <td>1016</td>\n",
       "      <td>67</td>\n",
       "      <td>62</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>Philippines</td>\n",
       "      <td>64.5</td>\n",
       "      <td>8.8</td>\n",
       "      <td>1062</td>\n",
       "      <td>67</td>\n",
       "      <td>62</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>Poland</td>\n",
       "      <td>73.0</td>\n",
       "      <td>3.9</td>\n",
       "      <td>480</td>\n",
       "      <td>77</td>\n",
       "      <td>69</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>Romania</td>\n",
       "      <td>72.0</td>\n",
       "      <td>6</td>\n",
       "      <td>559</td>\n",
       "      <td>75</td>\n",
       "      <td>69</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>Russia</td>\n",
       "      <td>69.0</td>\n",
       "      <td>3.2</td>\n",
       "      <td>259</td>\n",
       "      <td>74</td>\n",
       "      <td>64</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>South Africa</td>\n",
       "      <td>64.0</td>\n",
       "      <td>11</td>\n",
       "      <td>1340</td>\n",
       "      <td>67</td>\n",
       "      <td>61</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>Spain</td>\n",
       "      <td>78.5</td>\n",
       "      <td>2.6</td>\n",
       "      <td>275</td>\n",
       "      <td>82</td>\n",
       "      <td>75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>Sudan</td>\n",
       "      <td>53.0</td>\n",
       "      <td>23</td>\n",
       "      <td>12550</td>\n",
       "      <td>54</td>\n",
       "      <td>52</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>Taiwan</td>\n",
       "      <td>75.0</td>\n",
       "      <td>3.2</td>\n",
       "      <td>965</td>\n",
       "      <td>78</td>\n",
       "      <td>72</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>Tanzania</td>\n",
       "      <td>52.5</td>\n",
       "      <td>*</td>\n",
       "      <td>25229</td>\n",
       "      <td>55</td>\n",
       "      <td>50</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>Thailand</td>\n",
       "      <td>68.5</td>\n",
       "      <td>11</td>\n",
       "      <td>4883</td>\n",
       "      <td>71</td>\n",
       "      <td>66</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>Turkey</td>\n",
       "      <td>70.0</td>\n",
       "      <td>5</td>\n",
       "      <td>1189</td>\n",
       "      <td>72</td>\n",
       "      <td>68</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>34</th>\n",
       "      <td>Ukraine</td>\n",
       "      <td>70.5</td>\n",
       "      <td>3</td>\n",
       "      <td>226</td>\n",
       "      <td>75</td>\n",
       "      <td>66</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35</th>\n",
       "      <td>United Kingdom</td>\n",
       "      <td>76.0</td>\n",
       "      <td>3</td>\n",
       "      <td>611</td>\n",
       "      <td>79</td>\n",
       "      <td>73</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36</th>\n",
       "      <td>United States</td>\n",
       "      <td>75.5</td>\n",
       "      <td>1.3</td>\n",
       "      <td>404</td>\n",
       "      <td>79</td>\n",
       "      <td>72</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>37</th>\n",
       "      <td>Venezuela</td>\n",
       "      <td>74.5</td>\n",
       "      <td>5.6</td>\n",
       "      <td>576</td>\n",
       "      <td>78</td>\n",
       "      <td>71</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>38</th>\n",
       "      <td>Vietnam</td>\n",
       "      <td>65.0</td>\n",
       "      <td>29</td>\n",
       "      <td>3096</td>\n",
       "      <td>67</td>\n",
       "      <td>63</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>39</th>\n",
       "      <td>Zaire</td>\n",
       "      <td>54.0</td>\n",
       "      <td>*</td>\n",
       "      <td>23193</td>\n",
       "      <td>56</td>\n",
       "      <td>52</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "            Country  Life Expectancy People per Television  \\\n",
       "0         Argentina             70.5                     4   \n",
       "1        Bangladesh             53.5                   315   \n",
       "2            Brazil             65.0                     4   \n",
       "3            Canada             76.5                   1.7   \n",
       "4             China             70.0                     8   \n",
       "5          Colombia             71.0                   5.6   \n",
       "6             Egypt             60.5                    15   \n",
       "7          Ethiopia             51.5                   503   \n",
       "8            France             78.0                   2.6   \n",
       "9           Germany             76.0                   2.6   \n",
       "10            India             57.5                    44   \n",
       "11        Indonesia             61.0                    24   \n",
       "12             Iran             64.5                    23   \n",
       "13            Italy             78.5                   3.8   \n",
       "14            Japan             79.0                   1.8   \n",
       "15            Kenya             61.0                    96   \n",
       "16     Korea, North             70.0                    90   \n",
       "17     Korea, South             70.0                   4.9   \n",
       "18           Mexico             72.0                   6.6   \n",
       "19          Morocco             64.5                    21   \n",
       "20  Myanmar (Burma)             54.5                   592   \n",
       "21         Pakistan             56.5                    73   \n",
       "22             Peru             64.5                    14   \n",
       "23      Philippines             64.5                   8.8   \n",
       "24           Poland             73.0                   3.9   \n",
       "25          Romania             72.0                     6   \n",
       "26           Russia             69.0                   3.2   \n",
       "27     South Africa             64.0                    11   \n",
       "28            Spain             78.5                   2.6   \n",
       "29            Sudan             53.0                    23   \n",
       "30           Taiwan             75.0                   3.2   \n",
       "31         Tanzania             52.5                     *   \n",
       "32         Thailand             68.5                    11   \n",
       "33           Turkey             70.0                     5   \n",
       "34          Ukraine             70.5                     3   \n",
       "35   United Kingdom             76.0                     3   \n",
       "36    United States             75.5                   1.3   \n",
       "37        Venezuela             74.5                   5.6   \n",
       "38          Vietnam             65.0                    29   \n",
       "39            Zaire             54.0                     *   \n",
       "\n",
       "    People per Physician  Female Life Expectancy  Male Life Expectancy  \n",
       "0                    370                      74                    67  \n",
       "1                   6166                      53                    54  \n",
       "2                    684                      68                    62  \n",
       "3                    449                      80                    73  \n",
       "4                    643                      72                    68  \n",
       "5                   1551                      74                    68  \n",
       "6                    616                      61                    60  \n",
       "7                  36660                      53                    50  \n",
       "8                    403                      82                    74  \n",
       "9                    346                      79                    73  \n",
       "10                  2471                      58                    57  \n",
       "11                  7427                      63                    59  \n",
       "12                  2992                      65                    64  \n",
       "13                   233                      82                    75  \n",
       "14                   609                      82                    76  \n",
       "15                  7615                      63                    59  \n",
       "16                   370                      73                    67  \n",
       "17                  1066                      73                    67  \n",
       "18                   600                      76                    68  \n",
       "19                  4873                      66                    63  \n",
       "20                  3485                      56                    53  \n",
       "21                  2364                      57                    56  \n",
       "22                  1016                      67                    62  \n",
       "23                  1062                      67                    62  \n",
       "24                   480                      77                    69  \n",
       "25                   559                      75                    69  \n",
       "26                   259                      74                    64  \n",
       "27                  1340                      67                    61  \n",
       "28                   275                      82                    75  \n",
       "29                 12550                      54                    52  \n",
       "30                   965                      78                    72  \n",
       "31                 25229                      55                    50  \n",
       "32                  4883                      71                    66  \n",
       "33                  1189                      72                    68  \n",
       "34                   226                      75                    66  \n",
       "35                   611                      79                    73  \n",
       "36                   404                      79                    72  \n",
       "37                   576                      78                    71  \n",
       "38                  3096                      67                    63  \n",
       "39                 23193                      56                    52  "
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(Index(['Country', 'Life Expectancy', 'People per Television',\n",
       "        'People per Physician', 'Female Life Expectancy',\n",
       "        'Male Life Expectancy'],\n",
       "       dtype='object'), Country                    object\n",
       " Life Expectancy           float64\n",
       " People per Television      object\n",
       " People per Physician        int64\n",
       " Female Life Expectancy      int64\n",
       " Male Life Expectancy        int64\n",
       " dtype: object)"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.columns,df.dtypes"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# df[\"People per Television\"] = df[\"People per Television\"].as_numeric\n",
    "df[\"People per Television\"] = pd.to_numeric(df[\"People per Television\"],errors='coerce')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "df = df.dropna()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Country</th>\n",
       "      <th>Life Expectancy</th>\n",
       "      <th>People per Television</th>\n",
       "      <th>People per Physician</th>\n",
       "      <th>Female Life Expectancy</th>\n",
       "      <th>Male Life Expectancy</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Argentina</td>\n",
       "      <td>70.5</td>\n",
       "      <td>4.0</td>\n",
       "      <td>370</td>\n",
       "      <td>74</td>\n",
       "      <td>67</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Bangladesh</td>\n",
       "      <td>53.5</td>\n",
       "      <td>315.0</td>\n",
       "      <td>6166</td>\n",
       "      <td>53</td>\n",
       "      <td>54</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Brazil</td>\n",
       "      <td>65.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>684</td>\n",
       "      <td>68</td>\n",
       "      <td>62</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Canada</td>\n",
       "      <td>76.5</td>\n",
       "      <td>1.7</td>\n",
       "      <td>449</td>\n",
       "      <td>80</td>\n",
       "      <td>73</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>China</td>\n",
       "      <td>70.0</td>\n",
       "      <td>8.0</td>\n",
       "      <td>643</td>\n",
       "      <td>72</td>\n",
       "      <td>68</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>Colombia</td>\n",
       "      <td>71.0</td>\n",
       "      <td>5.6</td>\n",
       "      <td>1551</td>\n",
       "      <td>74</td>\n",
       "      <td>68</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>Egypt</td>\n",
       "      <td>60.5</td>\n",
       "      <td>15.0</td>\n",
       "      <td>616</td>\n",
       "      <td>61</td>\n",
       "      <td>60</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>Ethiopia</td>\n",
       "      <td>51.5</td>\n",
       "      <td>503.0</td>\n",
       "      <td>36660</td>\n",
       "      <td>53</td>\n",
       "      <td>50</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>France</td>\n",
       "      <td>78.0</td>\n",
       "      <td>2.6</td>\n",
       "      <td>403</td>\n",
       "      <td>82</td>\n",
       "      <td>74</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>Germany</td>\n",
       "      <td>76.0</td>\n",
       "      <td>2.6</td>\n",
       "      <td>346</td>\n",
       "      <td>79</td>\n",
       "      <td>73</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>India</td>\n",
       "      <td>57.5</td>\n",
       "      <td>44.0</td>\n",
       "      <td>2471</td>\n",
       "      <td>58</td>\n",
       "      <td>57</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>Indonesia</td>\n",
       "      <td>61.0</td>\n",
       "      <td>24.0</td>\n",
       "      <td>7427</td>\n",
       "      <td>63</td>\n",
       "      <td>59</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>Iran</td>\n",
       "      <td>64.5</td>\n",
       "      <td>23.0</td>\n",
       "      <td>2992</td>\n",
       "      <td>65</td>\n",
       "      <td>64</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>Italy</td>\n",
       "      <td>78.5</td>\n",
       "      <td>3.8</td>\n",
       "      <td>233</td>\n",
       "      <td>82</td>\n",
       "      <td>75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>Japan</td>\n",
       "      <td>79.0</td>\n",
       "      <td>1.8</td>\n",
       "      <td>609</td>\n",
       "      <td>82</td>\n",
       "      <td>76</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>Kenya</td>\n",
       "      <td>61.0</td>\n",
       "      <td>96.0</td>\n",
       "      <td>7615</td>\n",
       "      <td>63</td>\n",
       "      <td>59</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>Korea, North</td>\n",
       "      <td>70.0</td>\n",
       "      <td>90.0</td>\n",
       "      <td>370</td>\n",
       "      <td>73</td>\n",
       "      <td>67</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>Korea, South</td>\n",
       "      <td>70.0</td>\n",
       "      <td>4.9</td>\n",
       "      <td>1066</td>\n",
       "      <td>73</td>\n",
       "      <td>67</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>Mexico</td>\n",
       "      <td>72.0</td>\n",
       "      <td>6.6</td>\n",
       "      <td>600</td>\n",
       "      <td>76</td>\n",
       "      <td>68</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>Morocco</td>\n",
       "      <td>64.5</td>\n",
       "      <td>21.0</td>\n",
       "      <td>4873</td>\n",
       "      <td>66</td>\n",
       "      <td>63</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>Myanmar (Burma)</td>\n",
       "      <td>54.5</td>\n",
       "      <td>592.0</td>\n",
       "      <td>3485</td>\n",
       "      <td>56</td>\n",
       "      <td>53</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>Pakistan</td>\n",
       "      <td>56.5</td>\n",
       "      <td>73.0</td>\n",
       "      <td>2364</td>\n",
       "      <td>57</td>\n",
       "      <td>56</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>Peru</td>\n",
       "      <td>64.5</td>\n",
       "      <td>14.0</td>\n",
       "      <td>1016</td>\n",
       "      <td>67</td>\n",
       "      <td>62</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>Philippines</td>\n",
       "      <td>64.5</td>\n",
       "      <td>8.8</td>\n",
       "      <td>1062</td>\n",
       "      <td>67</td>\n",
       "      <td>62</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>Poland</td>\n",
       "      <td>73.0</td>\n",
       "      <td>3.9</td>\n",
       "      <td>480</td>\n",
       "      <td>77</td>\n",
       "      <td>69</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>Romania</td>\n",
       "      <td>72.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>559</td>\n",
       "      <td>75</td>\n",
       "      <td>69</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>Russia</td>\n",
       "      <td>69.0</td>\n",
       "      <td>3.2</td>\n",
       "      <td>259</td>\n",
       "      <td>74</td>\n",
       "      <td>64</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>South Africa</td>\n",
       "      <td>64.0</td>\n",
       "      <td>11.0</td>\n",
       "      <td>1340</td>\n",
       "      <td>67</td>\n",
       "      <td>61</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>Spain</td>\n",
       "      <td>78.5</td>\n",
       "      <td>2.6</td>\n",
       "      <td>275</td>\n",
       "      <td>82</td>\n",
       "      <td>75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>Sudan</td>\n",
       "      <td>53.0</td>\n",
       "      <td>23.0</td>\n",
       "      <td>12550</td>\n",
       "      <td>54</td>\n",
       "      <td>52</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>Taiwan</td>\n",
       "      <td>75.0</td>\n",
       "      <td>3.2</td>\n",
       "      <td>965</td>\n",
       "      <td>78</td>\n",
       "      <td>72</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>Thailand</td>\n",
       "      <td>68.5</td>\n",
       "      <td>11.0</td>\n",
       "      <td>4883</td>\n",
       "      <td>71</td>\n",
       "      <td>66</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>Turkey</td>\n",
       "      <td>70.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>1189</td>\n",
       "      <td>72</td>\n",
       "      <td>68</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>34</th>\n",
       "      <td>Ukraine</td>\n",
       "      <td>70.5</td>\n",
       "      <td>3.0</td>\n",
       "      <td>226</td>\n",
       "      <td>75</td>\n",
       "      <td>66</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35</th>\n",
       "      <td>United Kingdom</td>\n",
       "      <td>76.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>611</td>\n",
       "      <td>79</td>\n",
       "      <td>73</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36</th>\n",
       "      <td>United States</td>\n",
       "      <td>75.5</td>\n",
       "      <td>1.3</td>\n",
       "      <td>404</td>\n",
       "      <td>79</td>\n",
       "      <td>72</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>37</th>\n",
       "      <td>Venezuela</td>\n",
       "      <td>74.5</td>\n",
       "      <td>5.6</td>\n",
       "      <td>576</td>\n",
       "      <td>78</td>\n",
       "      <td>71</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>38</th>\n",
       "      <td>Vietnam</td>\n",
       "      <td>65.0</td>\n",
       "      <td>29.0</td>\n",
       "      <td>3096</td>\n",
       "      <td>67</td>\n",
       "      <td>63</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "            Country  Life Expectancy  People per Television  \\\n",
       "0         Argentina             70.5                    4.0   \n",
       "1        Bangladesh             53.5                  315.0   \n",
       "2            Brazil             65.0                    4.0   \n",
       "3            Canada             76.5                    1.7   \n",
       "4             China             70.0                    8.0   \n",
       "5          Colombia             71.0                    5.6   \n",
       "6             Egypt             60.5                   15.0   \n",
       "7          Ethiopia             51.5                  503.0   \n",
       "8            France             78.0                    2.6   \n",
       "9           Germany             76.0                    2.6   \n",
       "10            India             57.5                   44.0   \n",
       "11        Indonesia             61.0                   24.0   \n",
       "12             Iran             64.5                   23.0   \n",
       "13            Italy             78.5                    3.8   \n",
       "14            Japan             79.0                    1.8   \n",
       "15            Kenya             61.0                   96.0   \n",
       "16     Korea, North             70.0                   90.0   \n",
       "17     Korea, South             70.0                    4.9   \n",
       "18           Mexico             72.0                    6.6   \n",
       "19          Morocco             64.5                   21.0   \n",
       "20  Myanmar (Burma)             54.5                  592.0   \n",
       "21         Pakistan             56.5                   73.0   \n",
       "22             Peru             64.5                   14.0   \n",
       "23      Philippines             64.5                    8.8   \n",
       "24           Poland             73.0                    3.9   \n",
       "25          Romania             72.0                    6.0   \n",
       "26           Russia             69.0                    3.2   \n",
       "27     South Africa             64.0                   11.0   \n",
       "28            Spain             78.5                    2.6   \n",
       "29            Sudan             53.0                   23.0   \n",
       "30           Taiwan             75.0                    3.2   \n",
       "32         Thailand             68.5                   11.0   \n",
       "33           Turkey             70.0                    5.0   \n",
       "34          Ukraine             70.5                    3.0   \n",
       "35   United Kingdom             76.0                    3.0   \n",
       "36    United States             75.5                    1.3   \n",
       "37        Venezuela             74.5                    5.6   \n",
       "38          Vietnam             65.0                   29.0   \n",
       "\n",
       "    People per Physician  Female Life Expectancy  Male Life Expectancy  \n",
       "0                    370                      74                    67  \n",
       "1                   6166                      53                    54  \n",
       "2                    684                      68                    62  \n",
       "3                    449                      80                    73  \n",
       "4                    643                      72                    68  \n",
       "5                   1551                      74                    68  \n",
       "6                    616                      61                    60  \n",
       "7                  36660                      53                    50  \n",
       "8                    403                      82                    74  \n",
       "9                    346                      79                    73  \n",
       "10                  2471                      58                    57  \n",
       "11                  7427                      63                    59  \n",
       "12                  2992                      65                    64  \n",
       "13                   233                      82                    75  \n",
       "14                   609                      82                    76  \n",
       "15                  7615                      63                    59  \n",
       "16                   370                      73                    67  \n",
       "17                  1066                      73                    67  \n",
       "18                   600                      76                    68  \n",
       "19                  4873                      66                    63  \n",
       "20                  3485                      56                    53  \n",
       "21                  2364                      57                    56  \n",
       "22                  1016                      67                    62  \n",
       "23                  1062                      67                    62  \n",
       "24                   480                      77                    69  \n",
       "25                   559                      75                    69  \n",
       "26                   259                      74                    64  \n",
       "27                  1340                      67                    61  \n",
       "28                   275                      82                    75  \n",
       "29                 12550                      54                    52  \n",
       "30                   965                      78                    72  \n",
       "32                  4883                      71                    66  \n",
       "33                  1189                      72                    68  \n",
       "34                   226                      75                    66  \n",
       "35                   611                      79                    73  \n",
       "36                   404                      79                    72  \n",
       "37                   576                      78                    71  \n",
       "38                  3096                      67                    63  "
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "((38, 1), (38, 1))"
      ]
     },
     "execution_count": 46,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# x = ppl/television\n",
    "# y = ppl/doctor\n",
    "\n",
    "x = df[\"People per Television\"].values.reshape(-1,1).astype(np.float64)\n",
    "y = df[\"People per Physician\"].values.reshape(-1,1).astype(np.float64)\n",
    "\n",
    "x.shape,y.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Epoch 1/10\n",
      "38/38 [==============================] - 0s - loss: 1.3074     \n",
      "Epoch 2/10\n",
      "38/38 [==============================] - 0s - loss: 0.9138     \n",
      "Epoch 3/10\n",
      "38/38 [==============================] - 0s - loss: 0.8301     \n",
      "Epoch 4/10\n",
      "38/38 [==============================] - 0s - loss: 0.8089     \n",
      "Epoch 5/10\n",
      "38/38 [==============================] - 0s - loss: 0.8024     \n",
      "Epoch 6/10\n",
      "38/38 [==============================] - 0s - loss: 0.8001     \n",
      "Epoch 7/10\n",
      "38/38 [==============================] - 0s - loss: 0.7993     \n",
      "Epoch 8/10\n",
      "38/38 [==============================] - 0s - loss: 0.7989     \n",
      "Epoch 9/10\n",
      "38/38 [==============================] - 0s - loss: 0.7988     \n",
      "Epoch 10/10\n",
      "38/38 [==============================] - 0s - loss: 0.7987     \n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x7f6535aac390>]"
      ]
     },
     "execution_count": 45,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXMAAAEACAYAAABBDJb9AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAFR5JREFUeJzt3X9w3HWdx/HXuyRpt2AEJSLyY4MeKqI3wlCBaR33tEWk\njHfAnV45RmUyOA4gCMIonGdzMyfgHAMyKo6HgTkVAj0QsVUsKKxYGCRS0EpbUJykgPxYFWqBlIT2\nfX/stpuENvl+s5/d7+5nn4+ZHTab7+f7/WxDX/n0vZ/P52vuLgBAa5uTdQcAALUjzAEgAoQ5AESA\nMAeACBDmABABwhwAIhAkzM3s9Wb2f2a2wcweMbOjQ5wXAJBMR6DzXCXpJ+7+L2bWIWl+oPMC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ekXSnuw9l3aeArpR0oSL6BTWFS1ptZkNmdsZMB4ecmiiJRUZoPWa2l6SbJZ1bGaFHw923SzrC\nzLol/dDM3uXuLV+WMLOlkp5194fNrKB4/rU/0UJ3f9rMeiTdaWYbKv9a3qXgYe7uS0Kfs4k9Jeng\nCV8fWHkNLcLMOlQO8u+5+21Z96de3P1vlcV9xyuOGvNCSR81sxMk5SS9zsy+6+6fyLhfwbj705X/\nlszsVpXLursN8yzLLDH8Jh2S9HdmljezLkn/Kim2T9VNcfysdudaSevd/aqsOxKame1rZq+vPM9J\nWiJpY7a9CsPdL3b3g939rSr/vbsrpiA3s/mVfzHKzPaUdJyk303XptFTE6NaZOTu2ySdLekOSY9I\nutHdN2Tbq3DM7AZJ90l6u5ltMrPTs+5TSGa2UNK/SfpgZfrXWjM7Put+BbS/pLvN7GGVPwtY7e4/\nybhPSGY/SWsqn3fcL2mlu98xXQMWDQFABJjNAgARIMwBIAKEOQBEgDAHgAgQ5gAQAcIcACJAmANA\nBAhzAIjA/wMfCxkl5kSFaQAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x7f6535b5db00>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "sc = StandardScaler()\n",
    "x_ = sc.fit_transform(x)\n",
    "y_ = sc.fit_transform(y)\n",
    "\n",
    "inputs = Input(shape=(1,))\n",
    "preds = Dense(1,activation='linear')(inputs)\n",
    "\n",
    "model = Model(inputs=inputs,outputs=preds)\n",
    "sgd=keras.optimizers.SGD()\n",
    "model.compile(optimizer=sgd ,loss='mse')\n",
    "model.fit(x_,y_, batch_size=1, verbose=1, epochs=10, shuffle=False)\n",
    "plt.scatter(x_,y_,color='black')\n",
    "plt.plot(x_,model.predict(x_), color='blue', linewidth=3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Epoch 1/10\n",
      "38/38 [==============================] - 0s - loss: 0.0811         \n",
      "Epoch 2/10\n",
      "38/38 [==============================] - 0s - loss: 0.0749        \n",
      "Epoch 3/10\n",
      "38/38 [==============================] - 0s - loss: 0.0704     \n",
      "Epoch 4/10\n",
      "38/38 [==============================] - 0s - loss: 0.0666     \n",
      "Epoch 5/10\n",
      "38/38 [==============================] - 0s - loss: 0.0631     \n",
      "Epoch 6/10\n",
      "38/38 [==============================] - 0s - loss: 0.0599     \n",
      "Epoch 7/10\n",
      "38/38 [==============================] - 0s - loss: 0.0570     \n",
      "Epoch 8/10\n",
      "38/38 [==============================] - 0s - loss: 0.0542     \n",
      "Epoch 9/10\n",
      "38/38 [==============================] - 0s - loss: 0.0517     \n",
      "Epoch 10/10\n",
      "38/38 [==============================] - 0s - loss: 0.0493        \n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x7f6535bfaa90>]"
      ]
     },
     "execution_count": 44,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYEAAAEACAYAAABVtcpZAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAHZVJREFUeJzt3XuQVOWd//H3FwQcg3hjNIo44y1RE+8Rqawl7YIRqzQQ\nLRU0roloMC6xyt+mVt0ycTTG1WRzMep62/mxRgvQ0o3XTfASW8tEYIy3aEBRMyOigZYg3gYY4Lt/\nnB4cZs7pGaZPn9Pd5/OqmrL7PA99vjPO9Oc8z3POaXN3REQkm4akXYCIiKRHISAikmEKARGRDFMI\niIhkmEJARCTDFAIiIhkWSwiYWauZrTCzl/vpd5SZdZnZKXHsV0REyhPXSGA2cEKpDmY2BLgWmB/T\nPkVEpEyxhIC7PwOs7qfb94B7gZVx7FNERMqXyJqAme0BTHX3mwFLYp8iItK/pBaGfwlc0uO5gkBE\npApsk9B+vgLMMzMDRgMnmlmXuz/Ys5OZ6UZGIiKD4O6DOriOcyRgRBzhu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SvAm1JxmvYOo/zHgvR4/8/vTrnlr6u/V9/dUydlB\nA60d+BnBxZUvAaelXfNW/u4cCDxDcObQ88DEtGvuVf8cgjMM1wFvE0ybzAS+06PPjQRnQb1UZb87\nJWsHbgdW9fi7XTSQ19XFYiIiGZb2dJCIiKRIISAikmEKARGRDFMIiIhkmEJARCTDFAIiIhmmEBAR\nyTCFgIhIhv0fJSv4bmgS/CgAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x7f6535cf4b00>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# min-max 0,1\n",
    "sc = MinMaxScaler(feature_range=(0,1))\n",
    "x_ = sc.fit_transform(x)\n",
    "y_ = sc.fit_transform(y)\n",
    "\n",
    "inputs = Input(shape=(1,))\n",
    "preds = Dense(1,activation='linear')(inputs)\n",
    "\n",
    "model = Model(inputs=inputs,outputs=preds)\n",
    "sgd=keras.optimizers.SGD()\n",
    "model.compile(optimizer=sgd ,loss='mse')\n",
    "model.fit(x_,y_, batch_size=1, epochs=10, verbose=1, shuffle=False)\n",
    "plt.scatter(x_,y_,color='black')\n",
    "plt.plot(x_,model.predict(x_), color='blue', linewidth=3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Epoch 1/10\n",
      "38/38 [==============================] - 0s - loss: 0.1739     \n",
      "Epoch 2/10\n",
      "38/38 [==============================] - 0s - loss: 0.0847     \n",
      "Epoch 3/10\n",
      "38/38 [==============================] - 0s - loss: 0.0775     \n",
      "Epoch 4/10\n",
      "38/38 [==============================] - 0s - loss: 0.0762     \n",
      "Epoch 5/10\n",
      "38/38 [==============================] - 0s - loss: 0.0755     \n",
      "Epoch 6/10\n",
      "38/38 [==============================] - 0s - loss: 0.0750     \n",
      "Epoch 7/10\n",
      "38/38 [==============================] - 0s - loss: 0.0745     \n",
      "Epoch 8/10\n",
      "38/38 [==============================] - 0s - loss: 0.0741     \n",
      "Epoch 9/10\n",
      "38/38 [==============================] - 0s - loss: 0.0738     \n",
      "Epoch 10/10\n",
      "38/38 [==============================] - 0s - loss: 0.0736     \n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x7f6535533e48>]"
      ]
     },
     "execution_count": 50,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYEAAAEACAYAAABVtcpZAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAGAJJREFUeJzt3XuQVOWdxvHnBzLYUSfeAI3GnhhvmJtXxMSUXWURcZMS\ntTDKVrlextUYya02rm5M4iQVk2CZy3pJvOzE1T8YltwETbyutFsYLxRXNaDoMojKQicIkdAIDr/9\no3voYZjuPkOfvr7fT9WUp0+/c857PMN5znnf95xj7i4AQJhG1LsCAID6IQQAIGCEAAAEjBAAgIAR\nAgAQMEIAAAIWSwiYWbeZrTOzZUW+P9PMNprZovzPt+NYLwCgMnvFtJz7JN0u6YESZf7H3c+NaX0A\ngBjEciXg7vMlvVOmmMWxLgBAfGrZJzDRzBab2R/M7PgarhcAUERczUHlLJSUdPctZnaOpAclHVOj\ndQMAiqhJCLj75gHTj5jZL8zsQHffMLismfEwIwAYJnffoyb3OJuDTEXa/c1s3IDpCZJsqADo5+4t\n+XPTTTfVvQ5sH9vH9rXeTyViuRIws5mSUpIOMrM3JN0kqU2Su/s9kqaa2TWStkvKSroojvUCACoT\nSwi4+z+W+f5OSXfGsS4AQHy4Y7iGUqlUvatQVWxfc2P7wmSVtifFzcy80eoEAI3MzOQN0DEMAGgy\nhAAABIwQAICAEQIAEDBCAAACRggAQMAIAQAIGCEAAAEjBAAgYIQAAASMEACAgBECABAwQgAAAkYI\nAEDACAEACBghAAABIwQAIGCEAAAEjBAAgIARAgAQMEIAAAJGCABAwAgBAAgYIQAAASMEACBghAAA\nBCyWE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xLZixseaP/AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x7f65355f1c88>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# min-max -1,1\n",
    "sc = MinMaxScaler(feature_range=(-1,1))\n",
    "x_ = sc.fit_transform(x)\n",
    "y_ = sc.fit_transform(y)\n",
    "\n",
    "inputs = Input(shape=(1,))\n",
    "preds = Dense(1,activation='linear')(inputs)\n",
    "\n",
    "model = Model(inputs=inputs,outputs=preds)\n",
    "sgd=keras.optimizers.SGD()\n",
    "model.compile(optimizer=sgd ,loss='mse')\n",
    "model.fit(x_,y_, batch_size=1, verbose=1, epochs=10, shuffle=False)\n",
    "plt.scatter(x_,y_,color='black')\n",
    "plt.plot(x_,model.predict(x_), color='blue', linewidth=3)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Global TF Kernel (Python 3)",
   "language": "python",
   "name": "global-tf-python-3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
